class Maybe {
    static of(value){
        return new Maybe(value);
    }
   constructor(value){
        this._value = value;
    }
    map(fn){//接受一个处理值得函数
        // if(this.isNothing() === null){
        //     return Maybe.of(null)
        // }else if(this.isNothing() === undefined){
        //     return Maybe.of(undefined)
        // }else{
        //     return Maybe.of(fn(this._value))
        // }
       return  this._value === null ? Maybe.of(null):(this._value === undefined?Maybe.of(undefined) :Maybe.of(fn(this._value)));
         
    }
}

class Container {
    static of (value) {
        return new Container(value);
    }
    constructor(value){
        this._value = value;
    }
    map (fn) {
       return Container.of(fn(this._value)) 
    }
}
exports.Maybe = Maybe;
exports.Container = Container;
